﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SiteUnity.Layers.Entity.PageItems.Rates;
using SiteUnity.Layers.Application.Rates;

public partial class AjaxStarRatePage : System.Web.UI.Page
{
    int _starRateMax = 5;
    protected void Page_Load(object sender, EventArgs e)
    {
        SiteUnity.Layers.Entity.General.Page newPage = new SiteUnity.Layers.Entity.General.Page(new Guid(Request.Form["Guid"]));
        Rate newRate = new Rate();
        newRate.Value = decimal.Parse(Request.Form["Rate"]);
        newRate.IP = Request.UserHostAddress;
        newRate.TypeID = RateType.StarRate;

        if (newRate.Value >= 0 && newRate.Value < _starRateMax)
        {
            Response.Write("true");
            RateManager.insertRate(newPage, newRate);
        }
        else
            Response.Write("false");
    }
}